#include "user.h"

user::user()
{

}

bool user::match(std::string _ID)
{
    if(level == supervip)
    {
        if(_ID == ID)
            return 1;
        else if(_ID == subID)
            return 1;
    }
    else if(level == vip)
    {
        if(_ID == ID)
            return 1;
    }
    else if(level == normuser)
    {
        if(_ID == ID)
            return 1;
    }
    return 0;
}

float user::getrate()
{
    if(level == normuser)
        return 1;
    else if (level ==vip)
        return 0.95;
    else
        return 0.9;
}

bool user::levelup()
{
    if(level == normuser)
        level = vip;
    else if (level ==vip)
        level = supervip;
    return 1;
}

userlevel user::getlevel()
{
    return level;
}

bool user::gainpoint(int num)
{
    points += num;
    return 1;
}